package ycl.base.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import ycl.base.entity.Blacklist;
import ycl.base.req.BlacklistReq;
import ycl.base.res.BlacklistRes;
import ycl.base.service.BlacklistService;
import ycl.common.ApiResult;
import ycl.common.base.controller.BaseController;
import ycl.common.models.base.A;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

/**
 * <p>
 * 黑名单 前端控制器
 * </p>
 *
 * @author ycl
 * @since 2022-06-22 20:06:25
 */
@RestController
@RequestMapping("/blacklist")
@Api(tags = "黑名单")
@ApiSupport(order = 11)
public class BlacklistController
		extends BaseController<Blacklist, BlacklistReq, BlacklistRes> {

	@Resource
	private BlacklistService blacklistService;

	@Override
	public ApiResult<Page<BlacklistRes>> pageList(Blacklist blacklist) {
		return ApiResult.success(blacklistService.pageList(blacklist, BlacklistRes.class));
	}

	@Override
	public <E extends BlacklistReq> ApiResult<A> save(HttpServletRequest request, @Valid E e) {
		blacklistService.save(request, e, Blacklist.class);
		return ApiResult.success();
	}

	@Override
	public <E extends BlacklistReq> ApiResult<A> update(HttpServletRequest request, @Valid E e) {
		blacklistService.update(request, e, Blacklist.class);
		return ApiResult.success();
	}
}

